<template>
	<view class="content">
		<view class="img-box">
			<!-- <image :src=" headPath + imgurl.replace('\\','')" mode="widthFix"></image> -->
			<image :src="imgurl.replace('\\','')" mode="widthFix"></image>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				contractType:'',
				imgurl:'',
				signingname:'',
				Workerinfo:[]
			}
		},
		computed(){
			headPath:{
				return this.path
			}
		},
		onLoad(options) {
			console.log('路劲',options);
			this.getimgurl(options.id)
		
		},
		created() {
			this.headPath=this.path
		},
		methods: {
			getimgurl(id){
				uni.$get(this.path+'/contract/get/'+uni.getStorageSync('workerid')).then(res=>{
					if(res.code==200){
						this.Workerinfo.push(res.data)
						this.Workerinfo[0].contractStatus=0
						this.Workerinfo[0].contractPersonTwoTime=new Date().toISOString().slice(0,10).toString()+' 00:00:00'
						if(this.Workerinfo[0].contractType==1){
							this.contractType='1-1'
						}else if(this.Workerinfo[0].contractType==2){
							this.contractType='3-1'
						}else{
							this.contractType='2-1'
						}
						console.log('workerinfo',this.Workerinfo);
					}else{
            console.log('签名之后 获取人物信息 code 不为200');
          }
				}).then(res=>{
          // 下面是将签名发送给后端 然后合并合同、、this.headPath +
					this.Workerinfo[0].contractPersonTwoImgOne=id
					uni.$put(this.path+'/contract/update',this.Workerinfo[0]).then(res=>{
						console.log('上传签名和合同合并返回值结果',res);
					})
				}).then(res=>{
					uni.$post(this.path+'/contract/toPicture/'+this.contractType,this.Workerinfo[0]).then(res=>{
						if(res.code==200){
							this.imgurl=res.data
							console.log('签名上传合并成功 合同图片为',this.imgurl);//type3请求成功
              uni.showToast({
                title: '签名成功',
                icon: 'none'
              })
              // setTimeout(() => {
              //   uni.navigateBack()
              // },500)
						}else{
              console.log('签名上传合并返回值code不为200');//type3请求成功
            }
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.content{
	width: 750rpx;
	height: 100vh;
	.img-box{
		width: 95%;
		margin: 0 auto;
		image{
			width: 100%;
		}
	}
	.kongbai{
		width: 100%;
		height: 60rpx;
	}
	.enter-btn{
		position: fixed;
		bottom: 10px;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		button{
			width: 80%;
			background-color: #2f67ff;
			height: 35px;
			line-height: 35px;
			color: white;
			font-size: 14px;
		}
	}
}
</style>

